﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Helper;
using System.Data;
namespace CoreData
{
    public partial class vwusers
    {
        public long id { get; set; }
        public string username { get; set; }
        public string password { get; set; }
        public string fullname { get; set; }
        public string email { get; set; }
        public string address { get; set; }
        public string indentitycard { get; set; }
        public string numberphone { get; set; }
        public DateTime createdate { get; set; }
        public DateTime modifieddate { get; set; }
        public DateTime birthday { get; set; }
        public bool active { get; set; }
        public long groupid { get; set; }
        public string groupname { get; set; }
        public long moduleid { get; set; }
        public string modulename { get; set; }
        public string role { get; set; }
        public long serviceid { get; set; }
        public string servicename { get; set; }


        public vwusers()
        {
            username = "";
            password = "";
            fullname = "";
            email = "";
            address = "";
            indentitycard = "";
            numberphone = "";
            active = true;
            groupname = "";
            modulename = "";
            servicename = "";
        }

        static vwusers DynamicCast<T>(object row_data, object row_header) where T : vwusers
        {
            // row_data : DataRow
            // row_header : DataColumnCollection
            vwusers ret = new vwusers();
            DataRow dt = (DataRow)row_data;

            foreach (DataColumn column in (DataColumnCollection)row_header)
            {
                switch (column.ColumnName)
                {

                    case "id":
                        ret.id = ConvertObject.ToLong(dt[column]);
                        break;
                    case "username":
                        ret.username = ConvertObject.ToString(dt[column]);
                        break;
                    case "password":
                        ret.password = ConvertObject.ToString(dt[column]);
                        break;
                    case "fullname":
                        ret.fullname = ConvertObject.ToString(dt[column]);
                        break;
                    case "email":
                        ret.email = ConvertObject.ToString(dt[column]);
                        break;
                    case "address":
                        ret.address = ConvertObject.ToString(dt[column]);
                        break;
                    case "indentitycard":
                        ret.indentitycard = ConvertObject.ToString(dt[column]);
                        break;
                    case "numberphone":
                        ret.numberphone = ConvertObject.ToString(dt[column]);
                        break;
                    case "active":
                        ret.active = ConvertObject.ToBool(dt[column]);
                        break;
                    case "groupid":
                        ret.groupid = ConvertObject.ToLong(dt[column]);
                        break;
                    case "groupname":
                        ret.groupname = ConvertObject.ToString(dt[column]);
                        break;
                    case "moduleid":
                        ret.moduleid = ConvertObject.ToLong(dt[column]);
                        break;
                    case "modulename":
                        ret.modulename = ConvertObject.ToString(dt[column]);
                        break;
                    case "role":
                        ret.role = ConvertObject.ToString(dt[column]);
                        break;
                    case "serviceid":
                        ret.serviceid = ConvertObject.ToLong(dt[column]);
                        break;
                    case "servicename":
                        ret.servicename = ConvertObject.ToString(dt[column]);
                        break;
                    case "modifieddate":
                        ret.modifieddate = ConvertObject.ToDateTime(dt[column]);
                        break;
                    case "createdate":
                        ret.createdate = ConvertObject.ToDateTime(dt[column]);
                        break;
                    case "birthday":
                        ret.birthday = ConvertObject.ToDateTime(dt[column]);
                        break;
                    default:
                        break;
                }
            }
            return ret;
        }
    }
}
